jade.proto
Class FipaQueryInitiatorBehaviour
java.lang.Object
|
+--jade.core.behaviours.Behaviour
|
+--jade.core.behaviours.SimpleBehaviour
|
+--jade.proto.FipaQueryInitiatorBehaviour
- public abstract class FipaQueryInitiatorBehaviour
- extends SimpleBehaviour
This abstract behaviour implements the Fipa Query Interaction Protocol
from the point of view of the agent initiating the protocol, that is the
agent that sends the query-ref/query-if to a set of agents.
In order to use correctly this behaviour, the programmer should do the following:
- implements a class that extends FipaQueryInitiatorBehaviour.
This class must implement 2 methods that are called by FipaQueryInitiatorBehaviur:
-
public void handleOtherMessages(ACLMessage msg)
to handle all received messages different from "inform" message with
the value of :in-reply-to parameter set (fixed) correctly
-
public void handleInformeMessages(Vector messages)
to handle the "inform" messages received (eventually no message)
- create a new instance of this class and add it to the agent (agent.addBehaviour())
- Author:
- Fabio Bellifemine - CSELT S.p.A
- See Also:
- Serialized Form
|
Field Summary |
protected ACLMessage |
queryMsg
Deprecated. This is the query-refMsg sent in the first state of the protocol |
|
Method Summary |
void |
action()
Deprecated. action method of the behaviour. |
boolean |
done()
Deprecated. Check if this behaviour is done. |
abstract void |
handleInformMessages(java.util.Vector messages)
Deprecated. After having sent the queryMsg messages,
the protocol waits for the maximum timeout specified in those messages
(reply-by parameter), or until all the answers are received. |
abstract void |
handleOtherMessages(ACLMessage msg)
Deprecated. This method must be implemented by all subclasses. |
| Methods inherited from class jade.core.behaviours.Behaviour |
actionWrapper,
block,
block,
getDataStore,
handle,
isRunnable,
onEnd,
onStart,
restart,
root,
setAgent,
setDataStore |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
queryMsg
protected ACLMessage queryMsg
- Deprecated.
- This is the query-refMsg sent in the first state of the protocol
FipaQueryInitiatorBehaviour
public FipaQueryInitiatorBehaviour(Agent a,
ACLMessage msg,
java.util.List responders)
- Deprecated.
- constructor of the behaviour.
- Parameters:
a - is the current agent. The public variable
Agent myAgent contains then the pointer to the agent class.
A common usage of this variable is to cast it to the actual type of
Agent class and use the methods of the extended class.
For instance
appointments = (AppointmentAgent)myAgent.getAppointments() msg - is the Query message to be sent (notice that the performative
must be set to QUERY-IF or QUERY-REFresponders - is the group of agents
(i.e. a List of AID)
to which the query must be sent
FipaQueryInitiatorBehaviour
public FipaQueryInitiatorBehaviour(Agent a,
ACLMessage msg,
List responders)
- Deprecated.
- constructor of the behaviour.
- Parameters:
a - is the current agent. The public variable
Agent myAgent contains then the pointer to the agent class.
A common usage of this variable is to cast it to the actual type of
Agent class and use the methods of the extended class.
For instance
appointments = (AppointmentAgent)myAgent.getAppointments() msg - is the Query message to be sent (notice that the performative
must be set to QUERY-IF or QUERY-REFresponders - is the group of agents
(i.e. a List of AID)
to which the query must be sent
FipaQueryInitiatorBehaviour
public FipaQueryInitiatorBehaviour(Agent a,
ACLMessage msg)
- Deprecated.
- constructor of the behaviour.
In this case the set of agents to which the message is sent is
exactly the receivers set in the passed ACLMessage.
- See Also:
FipaQueryInitiatorBehaviour(Agent , ACLMessage , List )
action
public final void action()
- Deprecated.
- action method of the behaviour. This method cannot be overriden by
subclasses because it implements the actual FipaQuery protocol
- Overrides:
- action in class Behaviour
- Tags copied from class: Behaviour
- See Also:
CompositeBehaviour
done
public boolean done()
- Deprecated.
- Description copied from class: Behaviour
- Check if this behaviour is done. The agent scheduler calls this
method to see whether a
Behaviour still need to be
run or it has completed its task. Concrete behaviours must
implement this method to return their completion state. Finished
behaviours are removed from the scheduling queue, while others
are kept within to be run again when their turn comes again.
- Overrides:
- done in class Behaviour
- Tags copied from class: Behaviour
- Returns:
true if the behaviour has completely executed.
handleOtherMessages
public abstract void handleOtherMessages(ACLMessage msg)
- Deprecated.
- This method must be implemented by all subclasses.
After having sent the
query-ref message, the base class calls
this method everytime a new message arrives that is not an inform
message.
The method should react to this message in an
implementation-dependent way. The instruction
finished=true; should be executed to finish the
query protocol.
The class variable myAgent can be used to send
messages or, after casting, to execute other implementation-dependent
methods that belongs to the actual Agent object.
- Parameters:
msg - is the ACLMessage just arrived
handleInformMessages
public abstract void handleInformMessages(java.util.Vector messages)
- Deprecated.
- After having sent the
queryMsg messages,
the protocol waits for the maximum timeout specified in those messages
(reply-by parameter), or until all the answers are received.
If no reply-by parameter was set, an infinite timeout
is used, instead.
After this timeout, this method is called to react to all the received
INFORM messages.
Notice that the method might be called even when the timeout is expired
but no INFORM message is yet arrived; in such a case the size of the
Vectorparameter is 0. Therefore, this method is always
called to handle the last state of the protocol. The condition
messages.size()==0 allows to discriminate between
timeout elapsed / all responders have sent an answer (not necessarily
an INFORM answer!).
- Parameters:
messages - is the Vector of ACLMessage received so far